home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / misc / callfkt.lha / callfunction.a next >
Encoding:
Text File  |  1995-01-09  |  1.1 KB  |  33 lines

  1. ; CallFunction - call a library function via base/offset
  2. ;
  3. ; Copyright (C) 1993 by Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
  4. ;
  5. ; Permission to use, copy, modify, and distribute this software and its
  6. ; documentation for any purpose and without fee is hereby granted, provided
  7. ; that the above copyright notice appear in all copies and that both that
  8. ; copyright notice and this permission notice appear in supporting
  9. ; documentation.  This software is provided "as is" without express or
  10. ; implied warranty.
  11. ;
  12. ; Declaration from C:
  13. ;   extern __stkargs LONG CallFunction(APTR *base, LONG offset,
  14. ;       LONG d0, LONG d1, LONG d2, LONG d3, LONG d4, LONG d5, LONG d6, LONG d7,
  15. ;       APTR a0, APTR a1, APTR a2, APTR a3, APTR a4 );
  16.  
  17.     section text,code
  18.  
  19.     xdef _CallFunction
  20.  
  21. _CallFunction:
  22.     movem.l d2-d7/a2-a6,-(sp)   ; save registers
  23.     move.l  48(sp),a6           ; base in a6
  24.     move.l  52(sp),a5           ; offset
  25.     add.l   a6,a5               ; base+offset in a5
  26.     movem.l 56(sp),d0-d7/a0-a4  ; load registers
  27.     jsr     (a5)                ; call library function
  28.     movem.l (sp)+,d2-d7/a2-a6   ; restore registers
  29.     rts
  30.  
  31.     END
  32.  
  33.